Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] fix pytorch-paddle mapping index generate #6463

Merged
merged 20 commits into from
Jan 17, 2024

Conversation

RedContritio
Copy link
Contributor

No description provided.

Copy link

paddle-bot bot commented Jan 11, 2024

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6463.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@RedContritio
Copy link
Contributor Author

@sunzhongkai588 请看预览,业已修复

@RedContritio RedContritio mentioned this pull request Jan 11, 2024
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Jan 12, 2024
Copy link
Collaborator

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要不要把新增的几篇md文档去掉?这些需要 @zhwesky2010 review 吧

paddle.nn.LogSigmoid(name=None)
```

两者功能一致,参数完全一致。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是torch可以输入参数,paddle不能输入。torch参数更多?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这几个虽然 torch 可以输入参数,但是参数并不起到任何作用,我倾向于其算是无参数的情况

### [torch.nn.Sigmoid](https://pytorch.org/docs/stable/generated/torch.nn.Sigmoid.html)

```python
torch.nn.Sigmoid(*args, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是torch可以输入参数,paddle不能输入。torch参数更多?

### [torch.nn.Softsign](https://pytorch.org/docs/stable/generated/torch.nn.Softsign.html)

```python
torch.nn.Softsign(*args, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是torch可以输入参数,paddle不能输入。torch参数更多?

### [torch.nn.Tanh](https://pytorch.org/docs/stable/generated/torch.nn.Tanh.html)

```python
torch.nn.Tanh(*args, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是torch可以输入参数,paddle不能输入。torch参数更多?

### [torch.nn.Tanhshrink](https://pytorch.org/docs/stable/generated/torch.nn.Tanhshrink.html)

```python
torch.nn.Tanhshrink(*args, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是torch可以输入参数,paddle不能输入。torch参数更多?

| (torch.nn.functional.multilabel_margin_loss)[https://pytorch.org/docs/stable/generated/torch.nn.functional.multilabel_margin_loss.html#torch.nn.functional.multilabel_margin_loss] | 功能缺失 |
| (torch.nn.functional.ctc_loss)[https://pytorch.org/docs/stable/generated/torch.nn.functional.ctc_loss.html#torch.nn.functional.ctc_loss] | 功能缺失,torch 的 log_softmax+ctc_loss 相当于 paddle 的 ctc_loss |
| NOT-IMPLEMENTED-ITEM(`torch.nn.functional.multilabel_margin_loss`, https://pytorch.org/docs/stable/generated/torch.nn.functional.multilabel_margin_loss.html#torch.nn.functional.multilabel_margin_loss) |
| NOT-IMPLEMENTED-ITEM(`torch.nn.functional.ctc_loss`, https://pytorch.org/docs/stable/generated/torch.nn.functional.ctc_loss.html#torch.nn.functional.ctc_loss) |

***持续更新...***

## torch.Tensor.XX API 映射列表
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些删掉的原因是?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为上面几行是手动维护的,改成了自动维护的格式;因为其他的功能缺失没有原因描述,所以这里把原因也删除了

@zhwesky2010
Copy link
Collaborator

@RedContritio /docs/docs/guides/model_convert/pytorch_api_mapping_cn.md 这个文件是不是也可以顺带删除了,有些误导性

@@ -1,4 +1,4 @@
## [ 仅参数名不一致 ]torch.Tensor.split_size_or_sections
## [ 仅参数名不一致 ]torch.Tensor.vsplit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已 merge

@RedContritio
Copy link
Contributor Author

@RedContritio /docs/docs/guides/model_convert/pytorch_api_mapping_cn.md 这个文件是不是也可以顺带删除了,有些误导性

好的已删除

@RedContritio
Copy link
Contributor Author

要不要把新增的几篇md文档去掉?这些需要 @zhwesky2010 review 吧

这部分是因为这几个 api 在目录里提及了,所以需要有对应的映射描述文件。

@@ -1537,7 +1230,7 @@
| ----- | ----------- | ----------------- | --- |
| REFERENCE-MAPPING-ITEM(`torch.linalg.svd`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.svd.md) |
| REFERENCE-MAPPING-ITEM(`torch.linalg.matrix_power`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_power.md) |
| REFERENCE-MAPPING-ITEM(`torch.linalg.matrix_exp`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_exp.md) |
| REFERENCE-MAPPING-ITEM(`torch.linalg.matrix_power`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_exp.md) |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面这个链接看起来是错的,torch.linalg.matrix_exp.md?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已更新,列表项改回了 torch.linalg.matrix_exp

@@ -0,0 +1,15 @@
## [ 参数完全一致 ] torch.nn.AdaptiveAvgPool3d
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是 paddle参数更多 吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改


***持续更新...***

## torch.Tensor.XX API 映射列表
梳理了`torch.Tensor.XX`类 API 的 PyTorch-PaddlePaddle API 映射列表。

| 序号 | PyTorch API | PaddlePaddle API | 备注 |
|-----| --- | --- | --- |
| 1 | [torch.Tensor.device](https://pytorch.org/docs/stable/generated/torch.Tensor.device.html) | [paddle.Tensor.place](https://www.paddlepaddle.org.cn/documentation/docs/api/paddle/Tensor_cn.html#place) | 功能一致, 无参数 , [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.md) |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里删除了上百个 torch.Tensor.* 的原因是?

Copy link
Contributor Author

@RedContritio RedContritio Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的是之前其他人 pr 的时候,错误地将生成结果和源文件复制到了一起,产生的错误。 相关PR

### [paddle.nn.AdaptiveAvgPool2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/AdaptiveAvgPool2D_cn.html#adaptiveavgpool2d)

```python
paddle.nn.AdaptiveAvgPool2D(output_size, data_format='NCHW', name=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不是paddle参数更多?

@zhwesky2010
Copy link
Collaborator

@RedContritio 写文档需要尤其细心点,可以先自己整体自查一遍

@RedContritio
Copy link
Contributor Author

@RedContritio 写文档需要尤其细心点,可以先自己整体自查一遍

好的了解,关于 torch 支持 (*args, **kwargs) 但不实际生效这种情况,目前还是定为参数完全一致,其余问题已检查。

@@ -0,0 +1,15 @@
## [ 参数完全一致 ] torch.nn.LogSigmoid
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果不生效,是不是叫 无参数 更好

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实。无参数的 4 个 api 已修改

@@ -0,0 +1,20 @@
## [ 参数完全一致 ] torch.nn.AdaptiveAvgPool2d
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

仅 paddle 参数更多

@@ -0,0 +1,15 @@
## [ 参数完全一致 ] torch.nn.Tanh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个也是 无参数 吧

Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

建议那几个无参数的,后面把签名也改成无参数的形式,还是要以实际代码来,不用一定按文档

@zhwesky2010 zhwesky2010 merged commit e335f01 into PaddlePaddle:develop Jan 17, 2024
2 checks passed
@RedContritio RedContritio deleted the fix_error branch January 17, 2024 06:49
@RedContritio
Copy link
Contributor Author

lgtm

建议那几个无参数的,后面把签名也改成无参数的形式,还是要以实际代码来,不用一定按文档

好的了解,后续做对齐和检查的时候处理这种类型的问题。

RedContritio added a commit to RedContritio/PaddleDocs that referenced this pull request Apr 9, 2024
* fix errors

* format mapping index

* fix manual item

* fix

* add 2 mapping doc

* add check and exit

* add check in gendoc.sh

* fix

* fix root dir

* update some api mapping doc

* add mapping docs

* remove unused mapping index file

* fix unpaired mapping item

* fix doc

* update

* update

* update
RedContritio added a commit to RedContritio/PaddleDocs that referenced this pull request Apr 9, 2024
* fix errors

* format mapping index

* fix manual item

* fix

* add 2 mapping doc

* add check and exit

* add check in gendoc.sh

* fix

* fix root dir

* update some api mapping doc

* add mapping docs

* remove unused mapping index file

* fix unpaired mapping item

* fix doc

* update

* update

* update
jzhang533 pushed a commit that referenced this pull request Apr 9, 2024
* [Fix] fix pytorch-paddle mapping index generate (#6463)

* fix errors

* format mapping index

* fix manual item

* fix

* add 2 mapping doc

* add check and exit

* add check in gendoc.sh

* fix

* fix root dir

* update some api mapping doc

* add mapping docs

* remove unused mapping index file

* fix unpaired mapping item

* fix doc

* update

* update

* update

* add missing doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants